<!--
  @author yangjiangming
  @date 2018-12-10 20:40:28
-->
<!DOCTYPE html>
<html th:replace="~{work/modify/common/layout :: layout('取消', ~{::title}, ~{::content}, ~{::script})}"
      xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <title>工单管理-取消</title>
</head>
<body>

<div th:fragment="content">
    <style>
        .layui-form-item .layui-form-checkbox {
            width: 100%;
        }

        .layui-form-item .layui-form-checkbox span {
            width: 100%;
            white-space: normal;
        }

        .cancel-margin-left {
            margin-left: 65px;
        }
    </style>
    <form class="layui-form" action="" method="post">
        <input type="hidden" id="casSign" name="casSign" th:value="${casSign}"/>
        <input type="text" name="factoryPart" th:value="${cancelVO.factoryPart}" hidden>

        <div class="layui-form-item" th:if="${cancelVO.isCheck}">
            <label class="layui-form-label">退款审核</label>
            <div class="layui-inline" style="width: 320px">
                <input type="radio"
                       name="reviewStatus"
                       lay-filter="reviewStatus"
                       lay-verify="required"
                       th:each="item : ${cancelVO.reviewList}"
                       th:title="${item.text}"
                       th:value="${item.value}"
                       th:checked="${item.selected}">
            </div>
        </div>

        <div class="layui-form-item" id="review-success" style="display: none;">

            <div class="layui-form-item" th:if="${not #lists.isEmpty(cancelVO.refundList)}">
                <label class="layui-form-label">支付项目</label>
                <div class="layui-inline" style="width: 800px">
                    <table class="layui-table">
                        <colgroup>
                            <col width="150">
                            <col width="200">
                            <col width="200">
                            <col width="200">
                        </colgroup>
                        <thead>
                        <tr>
                            <th>金额项目</th>
                            <th>金额</th>
                            <th>支付方式</th>
                            <th>退款方式</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr th:each="item : ${cancelVO.refundList}">
                            <td th:text="${item.amountTypeName}"></td>
                            <td th:text="${#moneyUtil.parseToYuan(item.amount)}"></td>
                            <td th:text="${item.payChannelName}"></td>
                            <td th:switch="${item.type}">
                                <p th:case="1">原路线上退款</p>
                                <p th:case="2">线下现金退款</p>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>


            <div class="layui-row" style="overflow: hidden">
                <div class="layui-col-md12">
                    <div class="layui-form-item" id="reason" th:each="item : ${cancelList}">
                        <label class="cancel-margin-left" th:text="${item.key}"
                               style="width: 100%;text-align: left;"></label>
                        <br>
                        <div class="cancel-margin-left"
                             style="overflow: hidden;width: 100%;border-bottom: 1px solid #ccc; padding-bottom: 20px;">
                            <div class="layui-col-md3" th:each="reason:${item.value}">
                                <input th:title="${reason.text}" name="reason"
                                       th:value="|${reason.value}-${reason.text}|"
                                       lay-filter="reason"
                                       type="radio"
                                       lay-skin="primary"
                                       th:checked="${reason.selected}"
                                       th:disabled="${reason.disabled}"
                                       th:data-ext="${reason.ext1}"
                                       th:data-type="${reason.disabled != null && reason.disabled == true ? '2' : '0'}"
                                       title="取消缘由">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item" id="originalCode-wrapper" style="display: none;"></div>
                </div>

                <div class="layui-col-md12">
                    <div class="layui-form-item" style="padding: 0 64px; color: red">
                        <p style="color: #999999" id="remark"></p>
                        <p th:if="${cancelVO.factoryPart}">注意：工单存在厂商配件</p>
                        <p th:if="${cancelVO.part}">注意：工单有内采配件/外报/订单杂项费用</p>
                    </div>
                </div>
            </div>
        </div>

        <!--<th:block th:if="${cancelVO.isCheck}">
            <div class="layui-form-item" >
                <div class="layui-col-md12">
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <textarea name="content" id="content" lay-filter="content" th:placeholder="请输入审核缘由" class="layui-textarea"></textarea>
                        </div>
                    </div>
                </div>
            </div>
        </th:block>-->

        <div class="layui-form-item">
            <div class="cancel-margin-left">
                <input type="button" class="layui-btn" lay-submit lay-filter="save" style="width: 100px"
                       value="保存"></input>
                <th:block th:if="${cancelVO.jxjEngineerCount != null}">
                    <th:block th:if="${cancelVO.jxjEngineerCount > 0}">
                        <input type="button" class="layui-btn" lay-submit lay-filter="cancelAndSave" style="width: 125px" value="取消-复制订单"/>
                    </th:block>
                    <span style="color: red; margin-left: 10px;">
                            当前可服务家修匠工程师：[[${cancelVO.jxjEngineerCount}]]
                    </span>
                    <br>
                    <span th:if="${cancelVO.orderWork.masterId > 0 && orderChangeRecord.distributeCount > 0}"
                          style="color: red;">
                        订单已改派至：[[${cancelVO.orderWork.masterName}]]工程师，请核实是否需要撤回至原工程师
                    </span>
                </th:block>
                <th:block th:unless="${cancelVO.jxjEngineerCount != null}">
                    <span th:if="${cancelVO.orderWork.masterId > 0 && orderChangeRecord.distributeCount > 0}"
                          style="color: red;margin-left: 10px;">
                        订单已改派至：[[${cancelVO.orderWork.masterName}]]工程师，请核实是否需要撤回至原工程师
                    </span>
                </th:block>
            </div>
        </div>


    </form>
    <script type="text/html" id="originalCodeTemplate">
        <div class="layui-inline">
            <div class="layui-input-inline cancel-margin-left" style="margin-top: 4px" id="originalCode">
                <input style="height: 30px"
                       type="text"
                       name="originalCode"
                       class="layui-input"
                       maxlength="19"
                       th:value="${cancelVO.duplicateOrderId}"
                       readonly
                       lay-verify="required|number|reason"
                       placeholder="请输入:重复源单号">
            </div>
            <div th:if="${cancelVO.suspectedDuplicateOrder}"
                 class="layui-input-inline cancel-margin-left"
                 style="color: #F59A23;margin-top: 4px;margin-left: 10px;line-height: 30px">
                疑似修改重复
            </div>
        </div>
    </script>

    <script th:inline="javascript">
        var prepayAmount = [[${cancelVO.orderWork.prepayAmount}]];
        var channelPrepayAmount = [[${cancelVO.orderWork.channelPrepayAmount}]];
        var orderId = '';
        orderId = '[[${cancelVO.orderWork.orderId}]]';
        var workId = '';
        workId = '[[${cancelVO.orderWork.workId}]]';
        var cancelList = [[${cancelList}]];
        var duplicateMapId = [[${cancelVO.duplicateMapId}]]
    </script>
</div>


<script th:inline="javascript">
    var tips = [[${tips}]];

    var layuiModel = {
        oms_work_modify_cancel: "work/modify/zmn.oms.work.modify.cancel"
    };
</script>
</body>
</html>